﻿<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="plugins/layui/css/layui.css" media="all" />
        <link rel="stylesheet" href="css/global.css" media="all">
        <link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
        <link rel="stylesheet" href="css/table.css" />

       

        <script src="js/jquery-3.1.1.min.js"></script>
	</head>

	<body>
		<div style="margin: 15px;">

                <div class="admin-main">
                    <blockquote class="layui-elem-quote">
                        <a href="#" class="layui-btn layui-btn-small" id="dellAll">
                            <i class="layui-icon">&#xe608;</i> 批量删除
                        </a>
                        <a href="#" class="layui-btn layui-btn-small" id="reload">
                            <i class="fa fa-shopping-cart" aria-hidden="true"></i> 刷新页面
                        </a>
                        <a href="javascript:;" class="layui-btn layui-btn-small" id="search">
                            <i class="layui-icon">&#xe615;</i> 搜索
                        </a>
                    </blockquote>
                    <div id="main" class="layui-form"></div>

                    <div class="">
                        <!--admin-table-page-->

                        <div class="" style="float: left;">
                            <div id="page" class="page"></div>
                        </div>
                        <div class="" style="float: right;width:240px;">
                            <label style="float: left;padding:13px 0;">Showing 10 to 40 of  rows</label>
                            <div style="padding:10px 0;">
                                <select id="select_row" lay-filter="select_row">
                                    <option value="10">每页10行</option>
                                    <option value="20">每页20行</option>
                                    <option value="30">每页30行</option>
                                    <option value="40">每页40行</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>

		</div>
		<script type="text/javascript" src="plugins/layui/layui.js"></script>
        <script src="ajax/main.js"></script>
		<script>
            $(document).ready(function () {
                if (localStorage.rowlength) { $("#select_row").val(localStorage.rowlength); } else { localStorage.rowlength = 10; }
                var Array_title = new Array("分类", "时间", "文件", "处理");
                var Array_id = new Array("classid", "classname", "time", "filename");
                layui.use(['form', 'laypage', 'layer'], function () {
                    var $ = layui.jquery,
                    layer = parent.layer === undefined ? layui.layer : parent.layer;
                    laypage = layui.laypage;
                    form = layui.form();
                    CJPlugin.init({
                        'get_url': "GetHandler",
                        'Array_id': Array_id,
                        'container': "main",
                        'row': 10,
                        'column': 5,
                        'Array_title': Array_title,
                        'table': "newsclass",
                        'dialogID': 0,
                        'select_row': localStorage.rowlength,
                        'select_item': Array_id,
                        'editMode': 'edit_a'
                    });
                    //form.render(); //更新全部
                    //form.render('checkbox'); //刷新select选择框渲染
                    form.on('checkbox(selected-all)', function (data) {
                        var elem = data.elem;

                        $('#cont').children('tr').each(function () {
                            var $that = $(this);
                            //全选或反选
                            $that.children('td').eq(0).children('input[type=checkbox]')[0].checked = elem.checked;
                            form.render('checkbox');
                        });
                    });
                    //监听下拉框开关
                    //form.on('select(select_row)', function (data) {
                    //    namespaces.Param.changerow(data.value);
                    //});

                });
                //每页条数
                $('#select_row').on('change', function () {
                    CJPlugin.changeRow(this.value);
                });
                //删除
                $('#dellAll').on('click', function () {
                    CJPlugin.deleteAll();
                });
                //刷新
                $('#reload').on('click', function () {
                    CJPlugin.reLoad();
                });
            });
		</script>
	</body>

</html>



